import React, { Component } from 'react'

export default class ForceCom extends Component {
  //状态
  state = {
    count: 1
  }
  render() {
    return (
      <div>
        <h2>{this.state.count}</h2>
        <button onClick={() => {
          //更新状态
          // this.setState({
          //   count: this.state.count+1
          // })
          //更新状态
          this.state.count += 1;
          // console.log(this.state.count);
          //强制更新 force 强制  update 更新
          this.forceUpdate();
        }}>自增</button>
      </div>
    )
  }
}
